﻿using System.Collections.Generic;
using System.Linq;
using WalkingTec.Mvvm.Core;
using SelfService.Model.Models;


namespace SelfService.ViewModel.SysTimeIntervalVMs
{
    public partial class SysTimeIntervalListVm : BasePagedListVM<SysTimeInterval_View, SysTimeIntervalSearcher>
    {

        protected override IEnumerable<IGridColumn<SysTimeInterval_View>> InitGridHeader()
        {
            return new List<GridColumn<SysTimeInterval_View>>{
                this.MakeGridHeader(x => x.Name),
                this.MakeGridHeaderAction(width: 200)
            };
        }

        public override IOrderedQueryable<SysTimeInterval_View> GetSearchQuery()
        {
            var query = DC.Set<SysTimeInterval>()
                .Select(x => new SysTimeInterval_View
                {
				    ID = x.ID,
                    Name = x.Name,
                    StartTime = x.StartTime,
                    EndTime = x.EndTime
                })
                .OrderBy(x => x.ID);
            return query;
        }

    }

    public class SysTimeInterval_View : SysTimeInterval{

    }
}
